<template>
  <div class="myaccount">
    <el-tabs v-model="activeTab" type="card">
      <el-tab-pane label="知识助手账户" name="1">
        <div class="topShow">
          <div class="left-show">
            <div class="overview">
              <div class="overview-title">
                <span>累计收入(元)</span>
              </div>
              <div class="income-num">0.00</div>
            </div>
          </div>
          <div class="middle-show">
            <div class="overview">
              <div class="overview-title">
                <span>待结算金额(元)</span>
                <span>
                  <el-tooltip content="交易未完成，订单暂未结算到店铺可用余额的资金之和" placement="top" effect="light">
                    <i class="el-icon-warning-outline" />
                  </el-tooltip>
                </span>
              </div>
              <div class="income-num">0.00</div>
            </div>
          </div>
          <div class="right-show">
            <div class="available-income_show">
              <div class="overview-right">
                <div class="overview-title">
                  <span>可用余额（元）</span>
                </div>
                <div class="income-num">0.00</div>
              </div>
              <div class="handle-box">
                <el-button type="primary" size="small" @click=" toWithdraw">提现</el-button>
              </div>
            </div>
            <div class="freeze">
              <div>
                <span>冻结金额（元）：0.00</span>
              </div>
              <span class="freeze-record" @click="showFrostRecord">冻结记录</span>
            </div>
          </div>
        </div>
        <div class="table-title">
          <div>
            <span>近期账单明细</span>
            <span>
              <el-tooltip placement="right" effect="light">
                <div slot="content">
                  每笔订单产生后，微信官方会自动收取0.6%的手续费，
                  <br />本平台不加收任何手续费
                </div>
                <i class="el-icon-warning-outline" />
              </el-tooltip>
            </span>
          </div>
          <div class="all-bill" @click="toBillDetail">查看所有账单明细</div>
        </div>
        <el-table
          :data="billTableData"
          :header-cell-style="{background:'#fafbfc',color:'#606266'}"
          border
          style="width: 100%"
        >
          <el-table-column prop="time" label="时间" align="center" />
          <el-table-column prop="type" label="类型" align="center" />
          <el-table-column prop="name" label="商品名称|商品类型" align="center" />
          <el-table-column prop="payWay" label="支付方式|订单号" align="center">
            <template slot-scope="scope">
              <div>{{ scope.row.payWay }}</div>
              <div>{{ scope.row.orderNum }}</div>
            </template>
          </el-table-column>
          <el-table-column label="入账/支出（元）" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.income">+ {{ scope.row.income }}</span>
              <span v-if="scope.row.expend">- {{ scope.row.expend }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="payWay" label="操作" align="center">
            <template slot-scope="scope">
              <el-button type="text">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
      <el-dialog :visible.sync="frostRecordDialog" title="冻结记录" width="50%">
        <el-table
          :data="freezeTableData"
          :header-cell-style="{background:'#fafbfc',color:'#606266'}"
          border
          style="width: 100%"
        >
          <el-table-column prop="time" label="时间" align="center" />
          <el-table-column prop="freeze" label="冻结(元)" align="center" />
          <el-table-column prop="unfreeze" label="解冻(元)" align="center" />
          <el-table-column prop="details" label="详情" align="center" />
          <el-table-column prop="operator" label="操作人" align="center" />
        </el-table>

        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="frostRecordDialog = false">确 定</el-button>
        </span>
      </el-dialog>
      <el-tab-pane label="线下支付账户" name="2">
        <div class="topShow">
          <div class="left-show">
            <div class="overview line">
              <div class="overview-title">
                <span>累计收入(元)</span>
              </div>
              <div class="income-num">0.00</div>
            </div>
          </div>
          <div class="left-show">
            <div class="overview line">
              <div class="overview-title">
                <span>今日收入(元)</span>
              </div>
              <div class="income-num">0.00</div>
            </div>
          </div>
          <div class="left-show">
            <div class="overview line">
              <div class="overview-title">
                <span>待确认交易（笔）</span>
              </div>
              <div class="income-num">3</div>
            </div>
          </div>
          <div class="left-show">
            <div class="overview line">
              <div class="overview-title">
                <span>待收款（元）</span>
              </div>
              <div class="income-num">199.00</div>
            </div>
          </div>
        </div>
        <div class="title-line">
          <span class="part-label">交易记录</span>
          <div class="filter-part">
            <el-date-picker
              v-model="timeSelect"
              type="daterange"
              range-separator="|"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            />
            <el-input v-model="keyWordLine" style="width: 100px;" />
            <el-button type="primary" icon="el-icon-search">搜索</el-button>
          </div>
        </div>
        <el-table
          :data="lineTableData"
          :header-cell-style="{background:'#fafbfc',color:'#606266'}"
          border
          style="width: 100%"
        >
          <el-table-column prop="time" label="时间" align="center" />
          <el-table-column prop="type" label="订单类型" align="center" />
          <el-table-column prop="name" label="商品名称" align="center" />
          <el-table-column prop="payWay" label="支付方式|订单号" align="center">
            <template slot-scope="scope">
              <div>{{ scope.row.payWay }}</div>
              <div>{{ scope.row.orderNum }}</div>
            </template>
          </el-table-column>
          <el-table-column label="金额" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.income">+ {{ scope.row.income }}</span>
              <span v-if="scope.row.expend">- {{ scope.row.expend }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="agent" label="经办人" align="center" />
          <el-table-column prop="receiptStatus" label="收款状态" align="center" />
          <el-table-column label="操作" align="center">
            <template slot-scope="scope">
              <el-button type="text">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
export default {
  data() {
    return {
      activeTab: '1',
      frostRecordDialog: false,
      billTableData: [
        {
          time: '2019-03-06',
          type: '面授',
          name: '高中语文',
          payWay: '微信支付',
          orderNum: '023131131',
          income: '',
          expend: '95'
        }
      ],
      timeSelect: '',
      keyWordLine: '',
      lineTableData: [
        {
          time: '2019-03-06',
          type: '面授',
          name: '高中语文',
          payWay: '微信支付',
          orderNum: '023131131',
          income: '98',
          expend: '',
          agent: '王哈哈',
          receiptStatus: '收款成功'
        }
      ],
      freezeTableData: [
        {
          time: '2019-03-06',
          freeze: '300.00',
          unfreeze: '98.00',
          details: '--',
          operator: '刘美丽'
        }
      ]
    }
  },
  methods: {
    // 跳提现页面
    toWithdraw() {
      this.$emit('goWithdraw')
    },
    // 显示冻结记录弹框
    showFrostRecord() {
      this.frostRecordDialog = true
    },
    toBillDetail() {
      this.$emit('goBillDetail')
    }
  }
}
</script>

<style lang="scss" scoped>
.myaccount {
  .topShow {
    display: flex;
    align-items: flex-start;
    background-color: #fafbfc;
    font-size: 16px;
    font-weight: 500;
    color: #353535;
    height: 100%;
    .left-show {
      flex: 1;
    }
    .middle-show {
      flex: 1;
    }
    .right-show {
      flex: 2;
      padding: 24px 24px 14px;
      .available-income_show {
        padding-bottom: 7px;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        height: 76px;
        border-bottom: 1px solid #eee;
        .overview-right {
          height: 100px;
          font-size: 16px;
          line-height: 35px;
          font-weight: 500;
          box-sizing: border-box;
          .income-num {
            font-size: 24px;
          }
        }
        .handle-box {
          margin-top: auto;
        }
      }
      .freeze {
        padding-top: 13px;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        line-height: 22px;
        font-size: 16px;
        .freeze-record {
          color: #2a75ed;
          cursor: pointer;
        }
      }
    }
    .overview {
      border-right: 1px solid #eee;
      height: 100px;
      font-size: 16px;
      line-height: 35px;
      font-weight: 500;
      box-sizing: border-box;
      margin: 24px 0 24px 24px;
      .income-num {
        font-size: 24px;
      }
    }
    .overview.line {
      height: 70px;
      text-align: center;
    }
  }
  .table-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 0;
    line-height: 24px;
    font-weight: 500;
    .all-bill {
      font-size: 12px;
      color: #2a75ed;
      line-height: 17px;
      text-align: right;
      cursor: pointer;
      margin-right: 24px;
    }
  }
  .title-line {
    height: 36px;
    margin: 40px 0 24px;
    display: flex;
    justify-content: space-between;
    .part-label {
      height: 22px;
      line-height: 22px;
      padding-left: 10px;
      font-size: 16px;
      font-weight: bold;
      position: relative;
    }
    .part-label::before {
      position: absolute;
      top: 4px;
      left: 0;
      content: '';
      width: 2px;
      height: 14px;
      background: #2a75ed;
    }
    .filter-part {
      margin-right: 20px;
    }
  }
}
</style>
